package com.csdj.sc.comsumer.service;

import com.csdj.sc.common.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "provider",fallbackFactory = UserServiceFallbackFactory.class)
public interface IUserService {

    @GetMapping("/user/list")
    List<User> list();

    /**
     * 参数接在url后面
     * @param id
     * @return
     */
    @GetMapping("/user/detail")
    User getById(@RequestParam("id") int id);

    /**
     * 把路径一部分当着参数
     * @param id
     * @return
     */
    @GetMapping("/user/detail/{id}")
    User getByPath(@PathVariable("id") int id);

    /**
     * 用json格式来传递参数
     * @param user
     * @return
     */
    @PostMapping("/user/update")
    User post(@RequestBody User user);
}

